
package trim.differentmaterials.generator.columns;

import trim.common.*;
import trim.differentmaterials.coefficients.*;

/**
 *
 * @author Podorov Alexander
 */

public class RealPattern extends Column
{
    private Material material;
    private int count;    

    public RealPattern(int[] items, double estimation, Coefficient coefficient, Material material)
    {
        super(items, estimation, coefficient);
        this.material = material;
        count = 0;
    }

    public void setCount(int count)
    {
        this.count = count;
    }

    public int getCount()
    {
        return count;
    }
    
    public Material getMaterial()
    {
        return material;
    }    

    @Override
    public boolean equals(Object object)
    {
        if (object.getClass() == getClass())
        {
            RealPattern pattern = (RealPattern)object;

            if (this.material != pattern.material)
            {
                return false;
            }

            for (int i = 0; i < items.length; i++)
            {
                if (this.items[i] != pattern.items[i])
                {
                    return false;
                }
            }

            return true;
        }
        return false;
    }

    @Override
    public int hashCode()
    {
        int hash = 7;
        hash = 19 * hash + (this.material != null ? this.material.hashCode() : 0);
        hash = 19 * hash + this.count;
        return hash;
    }
}
